package com.xqc.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xqc.mode.TUser;
import com.xqc.service.TUserService;

/**
* @author 作者 Gavin.Dai/SNSSZ00036
* @dateTime 创建时间：2020年8月18日 下午3:36:24
* @version V1.0.0
* 类说明
*/
@RestController
public class TUserController {

	@Autowired
	private TUserService tUserService;
	
	@GetMapping("/add")
	public String add(){
	boolean result = true;
	for (int i = 0; i < 10; i++) {
		TUser user = new TUser();
		user.setUserName("张三"+i);
		user.setAge(20);
		user.setRemark("...");
		user.setPid((int)(Math.random()*50));
		 result = this.tUserService.insert(user);
	}
		if(result){
			return "success";
		}
		return "fail";
	}
	
	@GetMapping("/selectAll")
	public List<TUser> selectAll(){
		return this.tUserService.selectAll();
	}
	
	
	@GetMapping("/selectByUserIds")
	public List<TUser> selectByUserIds(){
		List<Long> userIds = new ArrayList<>();
		userIds.add(505499176348418048L);
		userIds.add(505499175908016129L);
		return this.tUserService.selectByUserIds(userIds);
	}
	
	
}
